package two;

public class 二五运算符 {

    public static void main(String[] args) {
        byte a = 1;
        int b = 2;
        // 没有long，都为int
        long b2 = 3;
        // 有long,都为long

        float f = 3.14f;
        float g = b + f;
        // float h = 3.0 + f;
        double c = 3.0 + f;

        int aa = 3;
        int bb = aa++;  // bb = 3, aa = 4
        aa = 3;
        bb = ++aa;      // aa = 4, bb = 4

        aa = 7;
        bb = 3;

        System.out.println(aa *= bb + 2);

        aa %= bb;
        System.out.println(aa);

        // 关系运算符 == 、!= 、> 、< 、>= 、<=

        // 逻辑运算符 &(与) 、|(或) 、 &&(短路与) 、||(短路或) 、!(非) 、^(异或)

        // 位运算符
        a = 3;
        b = 4;
        System.out.println(a & b);  //位与
        System.out.println(a | b);  //位或
        System.out.println(a ^ b);  //位异或
        System.out.println(~b);     //位取反
        System.out.println(b >> 1); //左移，相当于除以2


        int h = 25860399;
        int length = 16;
        System.out.println(h & (length-1));

    }
}
